import React from "react";
import {
  HashRouter,
  Switch,
  Route,
  Redirect
} from "react-router-dom";
import Home from "./Home";
import About from "./About";
import Login from "./Login";

class Router extends React.Component{
  render(){
    // const routers = [
    //   route:{
    //     path:"/",
    //     component:Home
    //   }
    // ]
    // new HashRouter({
    //   routers
    // })
    return(
      <HashRouter>  
        {/* 排他路由 */}
        <Switch>
          {/* <Route path="/about/:username" component={About}/> */}
          <Route path="/about" component={About}>

          </Route>
          <Route  path="/" component={Home}/>
          {/* <Route  path="/login" component={Login}/> */}
          {/* history */}
          <Redirect to="/login"/>
        </Switch>
      </HashRouter>
    )
  }
}

export default Router;